package com.lb.shopguide.util.lb;

import com.lb.shopguide.GuideApplication;
import com.lb.shopguide.base.BaseFragment;
import com.lb.shopguide.config.AppConfigManager;
import com.lb.shopguide.constants.AppConstant;
import com.lb.shopguide.entity.recommend.RecBannerBean;
import com.lb.shopguide.ui.fragment.guide.pay.FragmentSetAlipayAccount;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentMaterialGoods;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentPlayVideo;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentRecGoodsDetail;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentRecommendGoods;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentRecommendHome;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentRecommendOrderList;
import com.lb.shopguide.ui.fragment.guide.recommend.FragmentVirtualActivity;

/**
 * Create by kangzhao on 2018/12/6
 */
public class AdJumpUtil {

    private static final String pageCodeBzzx = "BZZX";
    private static final String pageCodeDdlb = "DDLB";
    private static final String pageCodeQubtsp = "QUBTSP";
    private static final String pageCodeQbbtsc = "QBBTSC";
    private static final String pageCodeTssy = "TSSY";
    private static final String pageCodeSpbfym = "SPBFYM";
    private static final String pageCodeZfbbdym = "ZFBBDYM";

    public static BaseFragment jumpToDestination(int jumpMode, String pageCode, String relCode, String relName, String jumpUrl) {
        // 跳转方式(1：指定页面 2：活动 3：商品 4：自定义链接跳转)
        switch (jumpMode) {
            case RecBannerBean.JUMP_ALL_PAGE:
                switch (pageCode) {
                    case pageCodeBzzx:
                        String url = "";
                        if (AppConfigManager.getAppconfigManager(GuideApplication.context()).getDevMode() == AppConstant.KEY_RUN_MODE_FORMAL) {
                            url = "https://singlepage.storeer.com/activity_2018/eightHalf_guide_help";
                        } else {
                            url = "https://sintest.storeer.com/activity_2018/eightHalf_guide_help";
                        }
                        return FragmentVirtualActivity.newInstance("赚钱秘籍", url);
                    case pageCodeDdlb:
                        return FragmentRecommendOrderList.newInstance();
                    case pageCodeQubtsp:
                        return FragmentRecommendGoods.newInstance();
                    case pageCodeQbbtsc:
                        return FragmentMaterialGoods.newInstance();
                    case pageCodeTssy:
                        return FragmentRecommendHome.newInstance();
                    case pageCodeSpbfym:
                        return FragmentPlayVideo.newInstance();
                    case pageCodeZfbbdym:
                        return FragmentSetAlipayAccount.newInstance(AppConstant.SET_ALIPAY_ACCOUNT);
                    //todo 是否设置
                }
                break;
            case RecBannerBean.JUMP_ACTIVITY:
                return FragmentVirtualActivity.newInstance("", jumpUrl);
            case RecBannerBean.JUMP_PRODUCT:
                return FragmentRecGoodsDetail.newInstance(relCode);
            case RecBannerBean.JUMP_URL:
                return FragmentVirtualActivity.newInstance(relName, jumpUrl);
            default:
                return null;
        }
        return null;
    }
}
